import java.math.BigDecimal;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Admin
 * Date: 2022-11-12
 * Time: 18:20
 */
import java.util.*;


import java.util.*;

public class Demo1 {

    static class Node {
        int value;
        Node next;

        public Node(int val) {
            this.value = val;
        }

    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        //读取nextInt剩余的空格,保证接下来的正常输入
        scan.nextLine();
        String str1 = scan.nextLine();
        String[] arr1 = str1.split(" ");

        Node head = new Node(-1);
        Node cur = head;
        for(int i = 0; i < n; i++) {
            int val = Integer.parseInt(arr1[i]);
            Node node = new Node(val);
            cur.next = node;
            cur = node;
        }


        String str2 = scan.nextLine();
        String[] arr2 = str2.split(" ");
        int left = Integer.parseInt(arr2[0]);
        int right = Integer.parseInt(arr2[1]);

        Node newHead =  func(head.next,left,right);

        while(newHead != null) {

            System.out.print(newHead.value + " ");
            newHead = newHead.next;
        }
    }

    public static Node func(Node node,int left,int right ){
        Node head = new Node(-1);
        head.next = node;
        Node cur = head;

        //走到反转区间起始节点的前一个节点处
        for(int i = 1; i < left; i++) {
            cur = cur.next;
        }

        //走到反转区间的起始节点
        Node prev = cur.next;
        for(int i = left; i < right; i++) {
            Node third = prev.next;
            prev.next = third.next;

            third.next = cur.next;
            cur.next = third;
        }

        return head.next;
    }
}
